package com.kcht.sylyg08.dao.impl;

import com.kcht.adp.common.sql.JPAConfig;
import com.kcht.sylyg08.dao.DataSourceBaseDao;
import com.kcht.sylyg08.dao.IAntDao;
import com.kcth.sylyg08.entity.Ant;

import javax.ejb.Singleton;
import javax.ejb.Startup;

/**
 * @program: G08ProductionLine
 * @description 天线信息持久层实现类
 * @author: X.Gao
 * @create: 2019-07-25 08:35
 **/

@Singleton
@Startup
@JPAConfig(dynaSqlFile = "mapper/antMapper.xml")
public class AntDao extends DataSourceBaseDao<Ant, Long> implements IAntDao {

    @Override
    public Ant selectAnt(String ip, String connect) {

        //通过IP地址和天线接口查询对应的天线信息
        return selectOneByJPQL("select a from Ant a where a.ip='"+ip+"' and a.connect='"+connect+"'");

    }

    @Override
    public int selectSignByLocation(String location) {
        return selectOneByJPQL("select sign from Ant a where a.location='"+location+"'");
    }

}
